j3deditor.bin.util
Class UserData

java.lang.Object
  extended by j3deditor.bin.util.UserData

public class UserData
extends java.lang.Object

Tool that loads, saves and manages user preferences.

Author:
Risto Seene

Field Summary
static java.lang.String dataPath
          relative path of the root directory of user files.
static java.lang.String languages
          relative path of the language directory.
static java.lang.String resources
          relative path of the resources directory.
 
Constructor Summary
UserData()
          Creates an instance of Userdata.
 
Method Summary
 boolean getBooleanData(java.lang.String key)
          Returns the value of the user preferences element which name is key.
 java.lang.Object getData(java.lang.String key)
          Returns the value of the user preferences element which name is key.
static java.io.File getFile(java.lang.String relativePath)
          Returns the file representation of the given path relatively to the applications root directory.
 int getIntData(java.lang.String key)
          Returns the value of the user preferences element which name is key.
 java.lang.String[][] getLanguageList()
          Returns the list of available languages from the file the list of languages are stored in.
 void saveData()
          Updates the file the user preferences are stored in.
 void setData(java.lang.String key, java.lang.Object data)
          Sets the value of the user preferences element which name is key.
 void updateLanguageList()
          Updates the list of available languages.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dataPath

public static final java.lang.String dataPath
relative path of the root directory of user files.

See Also:
Constant Field Values

languages

public static final java.lang.String languages
relative path of the language directory.


resources

public static final java.lang.String resources
relative path of the resources directory.

Constructor Detail

UserData

public UserData()
Creates an instance of Userdata.

Method Detail

updateLanguageList

public void updateLanguageList()
Updates the list of available languages.


saveData

public void saveData()
Updates the file the user preferences are stored in.


getLanguageList

public java.lang.String[][] getLanguageList()
Returns the list of available languages from the file the list of languages are stored in.

Returns:
Returns the list of available languages

getData

public java.lang.Object getData(java.lang.String key)
Returns the value of the user preferences element which name is key.

Parameters:
key - the name of the element
Returns:
Returns Object value of the element which name is key

getBooleanData

public boolean getBooleanData(java.lang.String key)
Returns the value of the user preferences element which name is key.

Parameters:
key - the name of the element
Returns:
Returns boolean value of the element which name is key

getIntData

public int getIntData(java.lang.String key)
Returns the value of the user preferences element which name is key.

Parameters:
key - the name of the element
Returns:
Returns int value of the element which name is key

setData

public void setData(java.lang.String key,
                    java.lang.Object data)
Sets the value of the user preferences element which name is key.

Parameters:
key - the name of the element
data - new value

getFile

public static java.io.File getFile(java.lang.String relativePath)
                            throws java.lang.Exception
Returns the file representation of the given path relatively to the applications root directory.

Parameters:
relativePath - path of a file somewhere inside the applications root directory.
Returns:
Returns the file representation of the given path relatively to the applications root directory.
Throws:
java.lang.Exception - if unable to create the required File